{% extends "base.html" %}

{% block title %}{% endblock %}

{% block head %}
<link href="/medias/css/group.css" rel="stylesheet" type="text/css"/>

{% endblock %}

{% block left_content %}
<div id="group_title">{{group.name}}</div>
<div id="group_desc" class="corner">
	<img alt="{{group.name}}" src="{{group.image.url_125x125|default:"images/default.jpg"}}">
	<ul>
		<li>{{group.summary|escape|linebreaksbr}}</li>
	</ul>
	<div></div>
</div>

<div id="top_action">
	<ul>
		{% ifequal has_user "true" %}<li class="corner"><a href="/topic/add/?groupid={{group.id}}">发表新主题</a></li>{% endifequal %}
		{% ifequal has_user "false" %}<li class="corner"><a href="/group/join/?groupid={{group.id}}">加入此圈子</a></li>{% endifequal %}
	</ul>
</div>
<div id="topic_list">

<table>
	<tr class="title">
		<td width="340">主题</td>
		<td width="90">作者</td>
		<td width="50">回复</td>
		<td width="100">最后更新</td>
	</tr>
{% for topic in topics.object_list %}	
	<tr class="content" height=25>
		<td ><a href="/topic/{{topic.id}}/">{{topic.title|slice:":27"|escape}}...</a></td>
		<td><a href="#">{{topic.user.username}}</a></td>
		<td>{{topic.replies_count}}</td>
		<td>{{topic.last_update|date:"Y-m-d H:i"|default:"N/A"}}</td>
	</tr>
{% endfor %}		
</table>
	
</div>
<div id="pagecut" class="pagination">
    <span class="step-links">
        {% if topics.has_previous %}
            <a href="?page={{ topics.previous_page_number }}"><< 较新的</a>
        {% endif %}

        <span class="current">
             {{ topics.number }} / {{ topics.paginator.num_pages }} 
        </span>

        {% if topics.has_next %}
            <a href="?page={{ topics.next_page_number }}">较早的 >></a>
        {% endif %}
    </span>
</div>
</div>
{% endblock %}

{% block right_content %}
{% if not request.user.is_authenticated %}
<h3><span class="sLeft"><<<a href="/group/">返回圈子列表</span></a></h3>
{% endif %}
{% if request.user.is_authenticated %}
<h3><span class="sLeft"><<<a href="/group/my/">返回我的圈子</span></a></h3>
{% endif %}

<h3><span class="sLeft">{{group.name}}用户</span><span class="sRight"><a href="#">(共{{join_count}}人)</a></span></h3>
{% for guser in join_users %}
<div id="sub-persion">
<ul>
	<li><a href="#"><img alt="{{guser.user.username}}" src="/medias/{{guser.image|default:"images/default_uimg.png"}}" width=46 height=46 /></a></li>
	<li><a href="#">{{guser.user.username}}</a></li>
</ul>	
</div>
{% endfor %}

{% endblock %}